/*
 * Copyright (C) 2010 GrayNM <gray-nm@mail.ru>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#ifndef __ZLTEXTSTATS_H__
#define __ZLTEXTSTATS_H__

#include <vector>

struct ZLTextLineStats {
	ZLTextLineStats():WordCounter(0),MaxWordLength(0),ImageCounter(0),SpaceCounter(0),StyleWidthOfSpaces(0),RealWidthOfSpaces(0),SymbolCounter(0) {}

	unsigned int	WordCounter;
	unsigned int	MaxWordLength;
	unsigned int	ImageCounter;
	unsigned int	SpaceCounter;
	unsigned int	StyleWidthOfSpaces;	// summary width of spaces according to style
	unsigned int	RealWidthOfSpaces;	// real width of empty space in line to extend spaces to it
	unsigned long	SymbolCounter;
};

class ZLPageStats {
public:
	ZLPageStats();
	~ZLPageStats() {}

	void reset();
	void accountLine(const ZLTextLineStats& info);
	void setNewDataFlag() {NewDataSet=true;}
	void clearNewDataFlag() {NewDataSet=false;}
	bool getNewDataFlag() {return NewDataSet;}

	unsigned int	getWordCount() const {return WordCounter;}
	unsigned int	getImageCount() const {return ImageCounter;}
	unsigned long	getSymbolCount() const {return SymbolCounter;}
	unsigned int	getLineCount() const {return Lines.size();}
	const ZLTextLineStats&	getLine(unsigned int num) const {return Lines[num];}

protected:
	bool			NewDataSet;
	unsigned int	WordCounter;
	unsigned int	ImageCounter;
	unsigned long	SymbolCounter;
	std::vector<ZLTextLineStats>	Lines;
};

#endif /* __ZLTEXTSTATS_H__ */
